package com.log4jviewer.ui.preferences.additional;

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.junit.Test;

/**
 * 
 * @author <a href="mailto:Daniil.Yaroslavtsev@gmail.com">Daniil Yaroslavtsev</a>
 */
public class FontSizeChangingTest extends AbstractAdditionalPageTest {

    protected static final SWTWorkbenchBot BOT = getBot();

    /**
     * Tests that the font size changes with the current "Additional" page`s spinner value.
     */
    @Test
    public void testFontSizeChanging() {

        int fontSizeBefore = LogDisplayPreferences.getLogFontSettings().getFontSize();
        int spinnerSelectionBefore = getFontSizeSpinnerSelection();
        assertTrue(fontSizeBefore == spinnerSelectionBefore);

        setFontSizeSpinnerSelection(spinnerSelectionBefore + 2); // increase Font size to +2

        int spinnerSelectionAfter = getFontSizeSpinnerSelection();
        int fontSizeAfter = LogDisplayPreferences.getLogFontSettings().getFontSize();
        assertTrue((fontSizeAfter == spinnerSelectionAfter) && ((fontSizeAfter - 2) == fontSizeBefore));
    }

}
